package com.example.pingapplication2.viewModel;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 倒计时界面对应的viewModel
 */
public class CountDownViewModel extends ViewModel {
    public MutableLiveData<Boolean> set = new MutableLiveData<>(false);//计时的时间是否设置
    public MutableLiveData<Integer> curTime = new MutableLiveData<>(0);//当前时间
    public MutableLiveData<Boolean> start = new MutableLiveData<>(false);//是否开始测试

    public Timer countDownPingTimer;
    public TimerTask countDownPingTimerTask;

    public Timer countDownRunTimer;
    public TimerTask countDownRunTimerTask;

    public synchronized void calCurTime(){
        int time = curTime.getValue();
        time--;
        curTime.postValue(time);
    }
}
